package com.cobra.activiti.pojo.vo;

import java.util.List;

/**
 * @author yaobin
 * @date 2020/4/9 0009 18:36
 * @Description 分页数据VO
 */
public class PageVO<T> {

    /**
     * 总数量
     */
    private Integer total;

    /**
     * 每页数量
     */
    private Integer size;

    /**
     * 总页数
     */
    private Integer pages;

    /**
     * 当前页
     */
    private Integer current;

    /**
     * 当前页记录
     */
    private List<T> records;

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        this.size = size;
    }

    public Integer getPages() {
        return total % size == 0 ? total / size : total / size + 1;
    }

    public Integer getCurrent() {
        return current;
    }

    public void setCurrent(Integer current) {
        this.current = current;
    }

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }

    @Override
    public String toString() {
        return "PageVO{" +
                "total=" + total +
                ", size=" + size +
                ", pages=" + pages +
                ", current=" + current +
                ", records=" + records +
                '}';
    }
}
